ARG PYTORCH="1.6.0"
ARG CUDA="10.1"
ARG CUDNN="7"

FROM pytorch/pytorch:${PYTORCH}-cuda${CUDA}-cudnn${CUDNN}-runtime

ENV TORCH_CUDA_ARCH_LIST="6.0 6.1 7.0+PTX"
ENV TORCH_NVCC_FLAGS="-Xfatbin -compress-all"
ENV CMAKE_PREFIX_PATH="$(dirname $(which conda))/../"


RUN apt-get update && apt-get install -y gcc-4.8 && ln -s /usr/bin/gcc-4.8 /usr/bin/gcc && apt-get install -y vim ffmpeg libsm6 libxext6 ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6 \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*


#setting pip source
WORKDIR /root
RUN mkdir /root/.pip
COPY pip.conf /root/.pip/pip.conf


#Install package
#RUN pip install -r requirements/build.txt -i https://mirrors.aliyun.com/pypi/simple/
RUN pip install python-dev
RUN pip install mmcv-full==latest+torch1.6.0+cu101 -f https://openmmlab.oss-accelerate.aliyuncs.com/mmcv/dist/index.html
RUN pip install opencv-python==4.2.0.34
RUN pip install albumentations==0.4.5
RUN pip install pydicom==2.0.0
RUN pip install pillow==7.1.2
RUN pip install pytorch-ignite==0.3.0
RUN pip install flask==1.1.2
RUN pip install flask-cors==3.0.8
RUN pip install scikit-learn==0.23.1
RUN pip install uwsgi==2.0.18
RUN conda clean -ya



#Copy AIS_COBB Project
WORKDIR /home
COPY AIS_COBB /home/AIS_COBB


WORKDIR /home/AIS_COBB

ENV LANG=C.UTF-8

RUN chmod +x /home/AIS_COBB/run.sh
EXPOSE 5081
ENTRYPOINT /home/AIS_COBB/run.sh


